﻿using System;

namespace StackExchange.Redis.Core.Extensions
{
    public static class DistributedCacheEntryExtensions
    {
        public static DistributedCacheEntryOptions SetAbsoluteExpiration(this DistributedCacheEntryOptions options, TimeSpan relative)
        {
            options.AbsoluteExpirationRelativeToNow = new TimeSpan?(relative);
            return options;
        }


        public static DistributedCacheEntryOptions SetAbsoluteExpiration(this DistributedCacheEntryOptions options, DateTimeOffset absolute)
        {
            options.AbsoluteExpiration = new DateTimeOffset?(absolute);
            return options;
        }


        public static DistributedCacheEntryOptions SetSlidingExpiration(this DistributedCacheEntryOptions options, TimeSpan offset)
        {
            options.SlidingExpiration = new TimeSpan?(offset);
            return options;
        }
    }
}
